# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=mfcuk
pkgver=0.3.8
pkgrel=9
groups=('blackarch' 'blackarch-wireless')
pkgdesc='MIFARE Classic Universal toolKit.'
arch=('x86_64' 'aarch64')
url='https://github.com/nfc-tools/mfcuk/'
license=('GPL2')
depends=('libnfc>=1.7.0')
makedepends=('autoconf' 'make')
source=("https://github.com/nfc-tools/mfcuk/archive/$pkgname-$pkgver.tar.gz")
sha512sums=('3b70a82af1de7df425c801c542f12d77d083aeccf5abf28c96840e58e91543726a38eee533ca16c420d80ab22845901f88db2982cd2bb16b382aaf82dcdeed0a')

prepare() {
  cd "$pkgname-$pkgname-$pkgver"

  sed -i 's/"\.\/data\//"\/usr\/share\/mfcuk\/data\//g' src/mfcuk_finger.c

  autoreconf -is
}

build() {
  cd "$pkgname-$pkgname-$pkgver"

  ./configure --prefix=/usr

  make
}

package() {
  cd "$pkgname-$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/share/mfcuk"

  make DESTDIR="$pkgdir" install

  cp -a src/data "$pkgdir/usr/share/mfcuk/"
  cp -a tools "$pkgdir/usr/share/mfcuk/"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" NEWS README INSTALL TODO\
    AUTHORS COPYING
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

